home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-04 | 4.3 KB | 164 lines | [TEXT/R*ch] |
- //
- //
- // IconTool
- //
- // a Newt 3.0+ plug-in (autopart) that contains a function
- // to extract icon information from Ben Gottlieb's Icon Editor
- // to be used by Newt's package frame.
- //
- // To use: Install IconTool on your Newton.
- // Create an icon using Icon Editor
- // Include the line: IconEditor:GetEditorIcon("<the icon>");
- // in the package frame of the source code you are creating
- // where <the icon> is the name of the icon you created in the
- // Icon Editor.
- //
- // Alternatively you can tap on Newt's overview button and select
- // "IconTool" from the list. Drag the window around so you can
- // see where you want to insert the GetEditorIcon statement. Make
- // sure you can see the insertion point and then tap the Paste
- // button. Edit the statement to include the name of your icon.
- //
- // NOTE: You can drag the information window of IconTool by the
- // bottom edge.
- //
- //------------------------
- // IconTool is freeware.
- // Serg Koren
- // archimag@netaxs.com
- // SergK@eworld.com
- //
- // Ver 1.0 07/04/95
- //
- //------------------------
- // Check out my Newton reviews on http://www.netaxs.com/~archimag/revw.html
- //------------------------
-
-
- // This is the main method that you call.
- // SYNTAX: IconTool:GetEditorIcon("<the icon>")
- //
- IconTool.GetEditorIcon
- func(which)
- begin
-
- local iconsoup := GetUnionSoup("Icons:BenG");
- local entry := (cursor := Query(iconsoup, {type: 'index})):entry();
-
- // check for the icon name we want
- while entry do
- begin
-
- if StrEqual(entry.name, which) then
- return entry.icon; // return it...
-
- entry := cursor:Next();
-
- end;
-
- return nil; // return icon name not found...
- end
- -----
- init
- func()
- begin
- // define some constants
-
- :defConst('kNewtSymbol, '|NewtDevEnv:TKnollSys|);
- :defConst('kPlugType,'tools);
- :defConst('kPlugSymbol,'IconTool);
- end
- -----
- IconTool._package.InstallScript
- func(partFrame,removeFrame)
- begin
- local gData := GetGlobals().(kNewtSymbol);
- if not gData then
- GetGlobals().(EnsureInternal(kNewtSymbol)) := gData := EnsureInternal({constants:{}, libraries: {}, protos: {}, tools: {}, views: {}, });
- gData.(kPlugType).(EnsureInternal(kPlugSymbol)) := partFrame.partData.(kPlugSymbol);
- end
- -----
- IconTool._package.RemoveScript
- func(removeFrame)
- begin
- RemoveSlot(GetGlobals().(kNewtSymbol).(kPlugType), kPlugSymbol);
- end
- -----
- IconTool
- // :doObj('add,'IconTool)
- // :doObj('build,'IconTool)
- // :doObj('Remove,'IconTool)
- //:saveApp(IconTool)
- {
- //
-
- _proto: protoFloatNGo,
- title: "Icon Tool",
- viewFlags: vFloating + vClickable,
- viewBounds: RelBounds(0,6,200,170),
-
- _package: {
- version: 100, // we scale this to n.nn
- copyright: "© 1995 by Serg Koren - Freeware",
- // devSignature should default to "Newt"
- },
-
- viewClickScript: func(unit)
- begin
- IconTool = self and :Drag(unit,nil); // drag it around....
- end,
-
- viewSetupFormScript: func()
- begin
- self.IconTool := self; // for dragging
- inherited:?viewSetupFormScript();
- end,
-
- }
- -----
- IconTool._package.partData
- {
- IconTool: IconTool._proto // this is required by the autopart
-
-
- }
- -----
- IconTool+maboutText
- {
- // about text
-
- viewclass: 'clParagraphView,
-
- text: " \u000D\u " && IconTool._package.copyright && "\u000D\u Version" && SubStr( NumberStr(IconTool._package.version),0,1) & "." & SubStr( NumberStr(IconTool._package.version),1,2) & "\u000D\u email: SergK@eworld.com" & "\u000D\u \u000D\u Newt Tool for extracting icons from \u000D\u Ben Gottlieb's Icon Editor.\u000D\u \u000D\u SYNTAX: \u000D\u IconTool:GetEditorIcon(<the icon>);",
- viewFlags: 3,
- viewBounds: RelBounds(35,20,300,180),
-
- }
- -----
- IconTool+paste
- {
- // button that lets us paste the method call into the insertion point
-
- _proto: protoTextButton,
- viewBounds: RelBounds (165, 5,35 ,15),
- text: "Paste",
-
- buttonClickScript: func()
- begin
- PostKeyString('viewFrontKey, "IconTool:GetEditorIcon( );");
- PlaySound(ROM_click);
- IconTool:close(); // get rid of our window
- end,
-
- }
- -----
- IconTool+mytitle
- {_proto: protoStaticText,
- viewBounds: RelBounds (20 ,20 ,100 ,37 ),
- text: "Icon Tool",
-
- }
-
- -----
- BYE!
-